// The first is the ID of the div, the second is a table with the translation
var translations = {
"participate_this_demo": ["Do you want to participate in this demonstration?", "Voulez vous participer a cette demonstration?"],
"you_participate_this_demo":["You participate in this demonstration.", "Vous participez a cette demonstration."],
"txt_add_demo": ["Add a demonstration", "Ajouter votre manifestation"],
"txt_savedemonstration_shortname": ["name: (will be in the url)", "nom: (sera dans l'adresse de la page)"],
"txt_savedemonstration_title": ["title: ", "titre: "],
"txt_savedemonstration_description": ["Description of the event: ", "Description de l'evenement: "],
"txt_saveparticipant_title": ["name: ", "nom: "],
"txt_saveparticipant_email": ["email", "email"],
"txt_saveparticipant_personaltext": ["personal text: ", "message personnel: "]
};
//"" : ["", ""]

var ENGLISH = 0;
var FRENCH = 1;

function getLangValue(){
  var lang = /lang=(\d+)/.exec(window.document.location.search);
  if (lang)
    return parseInt(lang[1]);
  lang = readCookie("lang");
  if (lang)
    return parseInt(lang);
  lang = FRENCH;
  return lang;
}

function translate(lang){
 if (lang == null) {
  lang = getLangValue();
 }
 createCookie("lang", lang, 365);
  
 for (var i in translations){
  var langTab = translations[i];
  var id = 'txt_' + i;
   try { 
     document.getElementById(id).innerHTML = langTab[lang];
   }
   catch(er) {
     debug('translation error ', er);
   }
 }
}
